<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String id = request.getParameter("id") == null ? "" : request.getParameter("id").toString().trim();
	String dept = request.getParameter("dept") == null ? "" : request.getParameter("dept").toString().trim();
	String org = request.getParameter("org") == null ? "" : request.getParameter("org").toString().trim();
%>
<!DOCTYPE HTML>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta http-equiv="pragma" content="no-cache" />
	<meta http-equiv="cache-control" content="no-cache"/>
	<meta http-equiv="expires" content="0" />
	<title>用户管理</title>
	<link rel="stylesheet" href="<%=path %>/skin/default/css/editor.css" type="text/css" />
	<link rel="stylesheet" href="<%=path %>/skin/default/css/button.css" type="text/css" />
	<link rel="stylesheet" href="<%=path %>/scripts/dialog/default/ymPrompt.css" type="text/css" />
	
	<script type="text/javascript" src="<%=path %>/scripts/jquery/jquery-1.8.2.js"></script>
	<script type="text/javascript" src="<%=path %>/scripts/jquery/jquery.json-2.2.min.js"></script>
	<script type="text/javascript" src="<%=path %>/scripts/jquery/jquery.placeholder.js"></script>
	<script type="text/javascript" src="<%=path %>/scripts/dialog/ymPrompt.js"></script>
	<script type="text/javascript" src="<%=path %>/scripts/validator.js"></script>
	<script type="text/javascript" src="<%=path %>/scripts/main.js"></script>
	<script type="text/javascript" src="<%=path %>/scripts/utils.js"></script>
	<script type="text/javascript">
		$(function(){
			var id = '<%=id %>';
			var dept = '<%=dept %>';
			var org = '<%=org %>';
			var options = {
				detailUrl:"Data",
				submitUrl:"SaveOrUpdate",
				returnUrl:"<%=path %>/user/view?dept="+dept+"&org="+org,
				submitBtn:"btnSaveOrModify",
				backBtn:"btnBack",
				openState:false,
				winSel:[
					{winTag:"defaultDept",winUrl:"<%=path %>/tree/dept?org="+org,winTitle:"部门选择框",winWidth:580,winHeight:380,winPos:"c"},
					{winTag:"defaultPost",winUrl:"<%=path %>/tree/position?org="+org,winTitle:"职位选择框",winWidth:580,winHeight:380,winPos:"c"},
					{winTag:"defaultLeader",winUrl:"<%=path %>/tree/user?org="+org+"&dept="+dept,winTitle:"用户选择框",winWidth:580,winHeight:380,winPos:"c"}
				],
				formId:id
			};
			if(id != ""){
				$("#password").removeAttr("name");
			}
			if(dept != ""){
				$.getJSON("<%=path %>/dept/Data?id="+dept,function(rs){
					$("#defaultDept").val(rs.deptName);
				});
			}
			$("#form").loadEditData(options);
			$("#resetPwd").click(function(){
				$.getJSON("<%=path %>/RandomPwd",function(rs){
					$("#password").attr("name","password");
					$("#password").val(rs);
					ymPrompt.alert({title:"温馨提示",message:"初始密码："+rs,width:280,height:160});
				});
			});
		});
	</script>
</head>
<body>
	<div id="container">
		<div class="toolBar">
			<div class="fl">
				<input type="button" id="btnSaveOrModify" name="btnSaveOrModify" class="btn btn82 btn_save" value="保 存" />
				<input type="button" id="btnBack" name="btnBack" class="btn btn82 btn_back" value="返 回" />
			</div>
		</div>
		<input type="hidden" id="basePath" name="basePath" value="<%=path %>" />
		<form action="" id="form" method="post">
			<input type="hidden" id="id" name="id" value="<%=id %>" />
			<table border="0" cellpadding="0" cellspacing="0" class="form_table">
				<tr>
					<td class="td_right">姓名：</td>
					<td><input type="text" id="realName" name="realName" value="" class="input_text" require="NotNull"/></td>
					<td class="td_right">工号：</td>
					<td><input type="text" id="workNumber" name="workNumber" value="" class="input_text"/></td>
					<td width="235"></td>
				</tr>
				<tr>
					<td class="td_right">账号：</td>
					<td><input type="text" id="account" name="account" value="" class="input_text" require="NotNull"/></td>
					<td class="td_right">密码：</td>
					<td><input type="text" id="password" name="password" value="" class="input_text" readonly="readonly"/></td>
					<td><input type="button" id="resetPwd" value="初&nbsp;始&nbsp;化&nbsp;密&nbsp;码" style="cursor: pointer;height: 26px;width: 85px;"></td>
				</tr>
				<tr>
					<td class="td_right">手机号码：</td>
					<td><input type="text" id="phoneNumber" name="phoneNumber" value="" class="input_text" require="Phone"/></td>
					<td class="td_right">电子邮箱：</td>
					<td><input type="text" id="mailbox" name="mailbox" value="" class="input_text" require="Email"/></td>
					<td>&nbsp;</td>
				</tr>
				<tr>
					<td class="td_right">性别：</td>
					<td>
						<input type="radio" id="man" name="sex" value="1" checked="checked"/>&nbsp;男
						&nbsp;&nbsp;
						<input type="radio" id="woman" name="sex" value="0"/>&nbsp;女
					</td>
					<td class="td_right">状态：</td>
					<td>
						<input type="radio" id="state1" name="status" value="Y" checked="checked"/>&nbsp;启用
						&nbsp;&nbsp;
						<input type="radio" id="state2" name="status" value="N"/>&nbsp;禁用
					</td>
					<td>&nbsp;</td>
				</tr>
				<tr>
					<td class="td_right">隶属部门：</td>
					<td colspan="3">
						<input type="hidden" id="defaultOrgCode" name="defaultOrgCode" value="<%=org %>" />
						<input type="hidden" id="defaultOrg" name="defaultOrg" value="" />
						<input type="hidden" id="defaultDeptCode" name="defaultDeptCode" value="<%=dept %>" />
						<input type="text" id="defaultDept" name="defaultDept" value="" class="input_long" readonly="readonly" />
					</td>
					<td>&nbsp;</td>
				</tr>
				<tr>
					<td class="td_right">所任职位：</td>
					<td colspan="3">
						<input type="hidden" id="defaultPostCode" name="defaultPostCode" value="" />
						<input type="text" id="defaultPost" name="defaultPost" value="" class="input_long" readonly="readonly" />
					</td>
					<td>&nbsp;</td>
				</tr>
				<tr>
					<td class="td_right">隶属领导：</td>
					<td colspan="3">
						<input type="hidden" id="defaultLeaderCode" name="defaultLeaderCode" value="" />
						<input type="text" id="defaultLeader" name="defaultLeader" value="" class="input_long" readonly="readonly" />
					</td>
					<td>&nbsp;</td>
				</tr>
			</table>
		</form>
	</div>
</body>
</html>